package com.xhis.system.print.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;

public class Result {

	private  SortedMap[] rows;
	
	private int rowCount;
	
	private List rowMap;

	public Result(){}
	
	public  SortedMap[] getRows(){
		return rows;
	}


	public  int getRowCount(){
		return this.rowCount;
	}

	public void setRows(List<Map> result){
		if(result==null){
			rows = null; 
		}else{
			rowMap = new ArrayList();
			for(Map map:result){
				SortedMap columnMap = new TreeMap(String.CASE_INSENSITIVE_ORDER);
				Set<Entry> entrySet = map.entrySet();
				for(Entry entry:entrySet){
					columnMap.put(entry.getKey(), entry.getValue());
				}
				this.rowMap.add(columnMap);
			}
			this.rows = ((SortedMap[])(SortedMap[])this.rowMap.toArray(new SortedMap[0]));
		}
	}
	
	public void setRowCount(int count){
		this.rowCount = count;
	}
}
